package cn.edu.sdjzu.xg.bysj.service;

import cn.edu.sdjzu.xg.bysj.dao.StudentClassDao;
import cn.edu.sdjzu.xg.bysj.domain.StudentClass;
import util.Condition;
import util.JdbcHelper;
import util.Pagination;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public class StudentClassService {
    private static StudentClassDao graduateProjectSourceDao = StudentClassDao.getInstance();
    private static StudentClassService studentClassService = new StudentClassService();

    public static StudentClassService getInstance() {
        return studentClassService;
    }

    public StudentClass find(Integer id) throws SQLException {
        Connection connection = JdbcHelper.getConn();
        StudentClass studentClass = StudentClassDao.find(id, connection);
        JdbcHelper.close(connection);
        return studentClass;
    }

    public Collection<StudentClass> findAll
            (List<Condition> conditionList_json_str, Pagination pagination)
            throws SQLException {

        Connection connection = JdbcHelper.getConn();
        Collection<StudentClass> studentClass = StudentClassDao.findAll(conditionList_json_str, pagination, connection);
        JdbcHelper.close(connection);
        return studentClass;
    }
}
